<template>
<view class="page">
	<template v-if="isLogin">
		<template v-if="loadingState.default">
			<loading :loadingState="loadingState"></loading>
		</template>
		<template v-else>
			<view class="body">    
				 
				<view class="data-wrap">
					<view class="hd"><text>监理</text></view>
					<view class="con">
						<template v-if="dataloading.loading">
							<loading :loadingState="dataloading" height="200"></loading>
						</template>
						<template v-else>
							<view class="category-list row-3">
								<navigator open-type="navigate" hover-class="none" :url="'/package_project/jl_pro/dataList/dataList?type=user&pid='+id+'&pro_type='+pro_type+'&uid='+params.uid" class="item">
									<view class="icon"><image src="@/static/images/jl_pc.png" mode="widthFix"></image></view>
									<view class="text">监理数据</view>
								</navigator>
								<!-- <view class="item">
									<view class="icon"><image src="@/static/images/export.png" mode="widthFix"></image></view>
									<view class="text">导出数据</view>
								</view> -->
								<view class="item" @click="openMap" data-type="jl" data-range="user">
									<view class="icon"><image src="@/static/images/blue_map.png" mode="widthFix"></image></view>
									<view class="text">监理地图</view>
								</view> 
								<navigator open-type="navigate" hover-class="none" :url="'/package_project/jl_pro/evaluateList/evaluateList?datatype=user&type=day&pid='+id+'&pro_type='+pro_type" class="item">
									<view class="icon"><image src="@/static/images/remarks_data.png" mode="widthFix"></image></view>
									<view class="text">每日评价</view>
								</navigator> 
								<navigator open-type="navigate" hover-class="none" :url="'/package_project/jl_pro/evaluateList/evaluateList?datatype=user&type=stage&pid='+id+'&pro_type='+pro_type" class="item">
									<view class="icon"><image src="@/static/images/stage_data.png" mode="widthFix"></image></view>
									<view class="text">阶段评价</view>
								</navigator> 
							</view>
							<view class="data-list ">
								<view class="item" v-for="(item,index) in jlinfo" :key="index">
									<view class="label">{{item.name}}</br>{{item.unit}}</view>
									<text class="val">{{item.value}}</text>
								</view>								 
							</view>
						</template>
						
					</view>
				</view>  
				
				<view v-if="works.length>0" class="data-wrap">
					<view class="hd"><text>下级成员</text></view>
					<view class="con">
						<view class="detail-wrap">
							<navigator open-type="navigate" hover-class="none" :url="'/package_project/jl_pro/workProjectDetail/workProjectDetail?team_name='+item.realname+'&pid='+id+'&pro_type='+pro_type+'&uid='+item.uid" class="detail-item" v-for="(item,index) in works" :key="index">  
								<view class="detail-input">
									<view class="content">
										<view class="val">{{item.realname}}</view> 
									</view>				
									<view class="icon">
										<view class="iconfont f-s68">&#xeb8a;</view>
									</view>	
								</view>			
							</navigator>  
						</view> 
					</view>
				</view>
			</view> 
		</template>
		
	</template> 
	
	   
</view>
</template>

<script> 
import loading from '@/components/loading-more.vue'
import empty from '@/components/empty.vue'
import {router} from '@/common/util.js'
export default{
	name:'demo',
	data(){
		return{ 
			isLogin:false,
			id:'',
			pro_type:'',
			pro_name:'',
			pro_name_1:'',
			userInfo:uni.getStorageSync('userInfo'),
			loadingState: {
				default: true,
				loading: false,
				completed: false
			},
			dataloading:{
				loading:true
			},
			params:{
				type_date:'',
				pid:'',
				uid:'',
				union_pid:''
			},
			detail:{},
			pcinfo:[],
			pc_member_info:[],
			pcinfo_month:[],
			fkinfo:[],
			jlinfo:[],
			works:[]
			
		}
	},
	onShow() {
		
	},
	async onLoad(params) {  
		this.id=params.pid;
		this.pro_type=params.pro_type; 
		this.params.uid=params.uid;
		this.params.team_name=params.team_name;
		this.isLogin = await this.$loginState('check');
		uni.setNavigationBarTitle({
			title:this.params.team_name+'团队数据'
		})
		if(this.isLogin){ 			
			this.jlproWorker();
			
		}
	},
	methods:{ 		
		
		// 获取监理数据概况
		jlproWorker:async function(){
			let res=await this.$api.pro_api.jlproWorker({
				pid: this.id,
				uid: this.params.uid, 
			})    
			if(res.data.ret==0){
				this.loadingState.default=false;
				this.dataloading.loading=false;
				this.jlinfo=res.data.data;
			}else{
				this.loadingState.default=false;
			}
		}, 
		 
		openMap:function(e){ 
			let type = e.currentTarget.dataset.type; 
			let range= e.currentTarget.dataset.range; 
			router({
				opentype:'navigate',
				url:'/pages/webview/webview',
				params:{ 					
					dataRange: range,
					memberInfo: "1",
					page_type: "map",
					pid: this.id,  
					pro_type: "2",
					project_type: "2",
					type: type, 
					uid: this.params.uid,
					
				}
			})
			
		} 
		
		
		
	},
	computed:{
		
	},
	components:{
		loading,
		empty
	}
}
</script>

<style lang="less">
	.data-wrap{
		width: 96%;
		margin: 20rpx auto;
		background: #fff;
		border-radius: 10rpx; 
		.hd{
			padding:15rpx 20rpx;
			border-bottom:1rpx solid #ddd;
			text{
				padding-left:20rpx;
				border-left:10rpx solid #f00;
				font-size: 32rpx;
				font-weight: bold;
			}
		}
		.con{
			min-height: 200rpx;
		}
	}
	.category-list{
		margin:10rpx 0 0;
	}
	.project-item{
		display: flex;
		padding:20rpx;
		font-size: 32rpx;
		.label{
			flex-shrink: 0;
		}
		.name{
			flex-grow: 2;
		}
	}
	.detail-wrap{ 
	}
	.data-list{
		display: flex;
		flex-wrap: wrap; 
		padding-bottom:20rpx;
		margin:0 20rpx;
		border-top:1rpx dashed #ddd;
		.item{ 
			width:25%;
			margin-top: 30rpx;
			font-size:28rpx;
			text-align: center;
			.label{
				height: 90rpx;
				color:#999;
			}
		}
	}
</style>
